<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'frontend.member.class.php');
$feObj = new FrontendMemberBase();

//
if( in_array($request_link_class, array('forgot_password', 'forgotten_password', 'reset_password')) ) {
	$request_link_class = 'password';
} elseif( in_array($request_link_class, array('change_password', 'profile_password')) ) {
	$request_link_class = 'profile';
	$request_link_subclass = 'password';
}

//
if( $request_link_subclass == '' ) {
	$request_link_current = 'member/' . $request_link_class . '/';
} else {
	$request_link_current = 'member/' . $request_link_class . '/' . $request_link_subclass . '/';
}
$injectObj->addb('func_get_tpl_pagelayout_content', 'context_wrap', 'URL_LINK', $request_link_current);

//
if( in_array($request_link_class, array('login', 'logout', 'register', 'password', 'forgot', 'forgot_password')) ) {
	//
} elseif( $_SESSION['suser']->userid == 0 || $_SESSION['suser']->usertype != 'customer' ) {
	$feObj->redirect('member/login/?goto=' . $request_type . '/' . $request_link);
}

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'core.validate.class.php');
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES_VALIDATE . 'common.validate.class.php');
$vObj = new CommonValidate();

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/member/member.class.php');
$memberObj = new MemberBase();

//link
if( $request_link_class ) {
	switch($request_link_class) {
	//---------------------------------------------------------------------------//
		case 'home':
			include_once(CONFIG_PATH . CONFIG_DIR_FRONTS . 'member/' . 'home.member.front.php');
			break;
	//---------------------------------------------------------------------------//
		default:
			if( util_file_exists(CONFIG_PATH . CONFIG_DIR_FRONTS . 'member/', $request_link_class, '.member.front.php') ) {
				include_once(CONFIG_PATH . CONFIG_DIR_FRONTS . 'member/' . $request_link_class . '.member.front.php');
			} else {
				include_once(CONFIG_PATH . CONFIG_DIR_FRONTS . 'member/' . 'home.member.front.php');
			}
			break;
	}
} else {
	include_once(CONFIG_PATH . CONFIG_DIR_FRONTS . 'member/' . 'home.member.front.php');
}
//
?>